home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / MODULA_2 / 2394.ZIP / M2TOOLS1.ZIP / SCREENHA.DEF < prev    next >
Text File  |  1990-09-12  |  6KB  |  208 lines

  1. DEFINITION MODULE ScreenHandler;
  2.  
  3.   (* Basic screen handling procedures.
  4.      The active window is considered as the screen. *)
  5.  
  6.   CONST
  7.     (* Screen attributes which can be used for any parameters requesting an
  8.        attribute, such as ScrollUp *)
  9.  
  10.     (* Monochrome attributes *)
  11.     Blank                  = 0;
  12.     Normal                 = 7;
  13.     Underlined             = 1;
  14.     Bold                   = 15;
  15.     Blink                  = 135;
  16.     Reverse                = 112;
  17.     BoldUnderlined         = 9;
  18.     BoldBlinking           = 143;
  19.     ReverseBlinking        = 240;
  20.     UnderlinedBlinking     = 129;
  21.     BoldUnderlinedBlinking = 137;
  22.  
  23.     (* Dark colours *)
  24.     Black                  =  0;
  25.     Blue                   =  1;
  26.     Green                  =  2;
  27.     Cyan                   =  3;
  28.     Red                    =  4;
  29.     Magenta                =  5;
  30.     Brown                  =  6;
  31.     LightGrey              =  7;
  32.  
  33.     (* Light colours *)
  34.     DarkGrey            =  8;
  35.     LightBlue           =  9;
  36.     LightGreen          = 10;
  37.     LightCyan           = 11;
  38.     LightRed            = 12;
  39.     LightMagenta       = 13;
  40.     Yellow              = 14;
  41.     White               = 15;
  42.  
  43. (*****************************************************************************)
  44. (*                                                                           *)
  45. (*                            P R O C E D U R E S                            *)
  46. (*                            -------------------                            *)
  47. (*                                                                           *)
  48. (*****************************************************************************)
  49.  
  50.   PROCEDURE CursorOn;
  51.  
  52.     (* This routine will re-display the cursor onto the screen *)
  53.  
  54.     (* 11 indicates the highest value of display of the cursor and 12 the
  55.        lowest value of display for the cursor *)
  56.  
  57.  
  58.   PROCEDURE CursorOff;
  59.  
  60.     (* This routine will turn off the cursor.  It may be re-instated by a call
  61.        to CursorOn *)
  62.  
  63.  
  64.   PROCEDURE DisplayEntryBar (Length : CARDINAL);
  65.  
  66.     (* Display a bar, in reverse video, for given length *)
  67.  
  68.  
  69.   PROCEDURE At (x, y : INTEGER);
  70.  
  71.     (* Positions the cursor at row x and column y.  The home position is the
  72.        top left hand corner at (0,0) *)
  73.  
  74.  
  75.   PROCEDURE ScrollUp (TopRow, TopCol,
  76.                       BottRow, BottCol,
  77.                       Rows, Attribute : CARDINAL);
  78.  
  79.     (* Scrolls the given area up Rows rows.  A blank line is inserted at the
  80.        bottom of the area with the given attribute.
  81.  
  82.        e.g. Attribute `Reverse' will give reverse video spaces for the last
  83.        line *)
  84.  
  85.  
  86.   PROCEDURE ScrollDown (TopRow, TopCol,
  87.                         BottRow, BottCol,
  88.                         Rows, Attribute : CARDINAL);
  89.  
  90.     (* Same as above except moving the text down Rows rows. *)
  91.  
  92. (*****************************************************************************)
  93.  
  94.   PROCEDURE GetGCard () : BOOLEAN;
  95.  
  96. (*****************************************************************************)
  97.  
  98.   PROCEDURE SetAttribute (Attrib : CARDINAL);
  99.  
  100.     (* All following text will be printed with the chosen attribute.
  101.        Should colours be used then the number entered must be the
  102.        combined number. *)
  103.  
  104.  
  105.   PROCEDURE SetColourAttribute (Fore, Back : CARDINAL);
  106.  
  107.     (* Sets both foreground and background colours.
  108.        The colours must be entered as the numbers for each of the
  109.        foreground and background - NOT the combined number *)
  110.  
  111.  
  112.   PROCEDURE SetForegroundColour (Colour : CARDINAL);
  113.  
  114.     (* Colour is a cardinal number as listed above.  All text displayed
  115.        after this command will be in the required text *)
  116.  
  117.  
  118.   PROCEDURE SetBackgroundColour (Colour : CARDINAL);
  119.  
  120.     (* Colour is a cardinal number as listed above.  All text displayed
  121.        after this command will be in the required text *)
  122.  
  123.  
  124.   PROCEDURE GetColourCode (ForegroundColour,
  125.                            BackgroundColour : CARDINAL;
  126.                            Blink            : BOOLEAN) : CARDINAL;
  127.  
  128.     (* Input the two colours and a cardinal number will be returned which
  129.        can be used as an attribute for direct memory accessing.
  130.  
  131.        You only need use this procedure if you have a colour monitor.  Should
  132.        you have a monochrome monitor then use the procedure SetMonoAttrib. *)
  133.  
  134.  
  135.  
  136.   PROCEDURE Setqc (    Pos,
  137.                        Attrib : CARDINAL;
  138.                    VAR Done   : BOOLEAN);
  139.  
  140.     (* You can set up to 20 pre-defined colour combinations that can be
  141.        accessed through a look-up table.  To set the colours at position Pos
  142.        in the table, you must pass a combined foreground and background colour
  143.        attribute, which can be calculated by the procedure GetColourCode *)
  144.  
  145.  
  146.   PROCEDURE qc (Pos : CARDINAL) : CARDINAL;
  147.  
  148.     (* QuickColour.
  149.        Returns the screen attribute from position Pos of a 20 record look-up
  150.        table. See definition of procedure Setqc. *)
  151.  
  152.  
  153.   PROCEDURE CursorRight (Distance : CARDINAL);
  154.  
  155.     (* Move the cursor distance spaces to the right.  Cursor wraps to the
  156.        beginning of the next line *)
  157.  
  158.  
  159.   PROCEDURE CursorLeft (Distance : CARDINAL);
  160.  
  161.     (*  Move the cursor distance spaces to the left.  Cursor wraps to the
  162.     end of the previous line *)
  163.  
  164.  
  165.   PROCEDURE CursorUp (Distance : CARDINAL);
  166.  
  167.     (* Move cursor up distance spaces *)
  168.  
  169.  
  170.   PROCEDURE CursorDown (Distance : CARDINAL);
  171.  
  172.     (* Move cursor down distance spaces *)
  173.  
  174.  
  175.   PROCEDURE CursorHome;
  176.  
  177.     (* Moves the cursor to the beginning of the line *)
  178.  
  179.  
  180.   PROCEDURE CursorEnd;
  181.  
  182.     (* Moves the cursor to the end of the line *)
  183.  
  184.  
  185.   PROCEDURE CursorTop;
  186.  
  187.     (* Moves the cursor to the top of the page, beginning of the line *)
  188.  
  189.  
  190.  
  191.   PROCEDURE CursorBottom;
  192.  
  193.     (* Moves the cursor to the bottom of the page and end of the line *)
  194.  
  195.  
  196.  
  197.   PROCEDURE SaveCursorPosition;
  198.  
  199.     (*  Saves the cursor position.  It is restored with
  200.         `RestoreCursorPosition' *)
  201.  
  202.  
  203.  
  204.   PROCEDURE RestoreCursorPosition;
  205.  
  206.     (* See above *)
  207.  
  208. END ScreenHandler.